// 积分活动，查询出金账户列表
import { getIntegralActivityOutAcc } from "@/request/integralactivity"
import { useEffect, useState } from "react"

export default function useAccountOutAcc () {
    const [ accountOutAccOptions, setAccountOutAccOptions ] = useState<Array<Record<string,unknown>>>([])
    const getData = async () => {
        const { code, data } = await getIntegralActivityOutAcc()
        if ( code === 200 ) {
            setAccountOutAccOptions( data?.map((item: { accountName: any; id: any })=>{
                return {
                    ...item,
                    label:item.accountName,
                    value:item.id
                }
            }) )
        } else {
            setAccountOutAccOptions( [] )
        }
    }
    useEffect( () => {
        getData()
    }, [] )
    return accountOutAccOptions
}